package test;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: LIUYANJIAO
 * Date: 2024-06-05
 * Time: 11:24
 */
public class Min {
    public static void main(String[] args) {
        System.out.println("这是一个异常处理的例子");
        try{
            int i=10;
            i/=0;
        }
        catch (ArithmeticException e){
            System.out.println("异常是："+e.getMessage());
        }
        finally {
            {
                System.out.println("finaly语句被执行");
            }
        }
    }
    public static void main1(String[] args) {
        Simulator simulator=new Simulator();
        System.out.println("当前模拟警车的声音");
        simulator.simulate(new PoliceCar());
        System.out.println("当前模拟救护车的声音");
        simulator.simulate(new AmbulanceCar());
        System.out.println("当前模拟消防车的声音");
        simulator.simulate(new FireCar());

    }
}
